package server;

import comm.ServerComm;
import comm.ServerInterface;
import comm.ServerSideMessage;

public class Server implements MoodishServer {
	
	private ServerComm serverComm;
	
	@Override
	public void start(ServerComm serverComm) {
		this.serverComm = serverComm;
		
		serverComm.start();
		fludingNetwork();
	}
	
	public void fludingNetwork(){
		while(true){
			
			if(serverComm.hasNextMessage()){
				ServerSideMessage m = serverComm.getNextMessage();
				System.out.println("@SERVER Module@" + "GET MSG FROM: "  +m.getClientNickname()+" ,payload= "+m.getPayload());
			}
			
			
		}
		
	}
	
	
	
public static void main(String[] args ){
	
	ServerInterface serverComm = new ServerInterface();
	Server servidor = new Server();
	servidor.start(serverComm);
}
	

}
